#pragma GCC optimize(2)
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <map>
#include <vector>
#include <unordered_map>

using namespace std;
using LL = long long;
using PII = pair<int, int>;

/*
greedy question needs to prove

1: we can supress that if i < j and a[i] is red and a[j] is blue so can change swap them
2: we can supress that if both a[i] and a[j] is blue so the smaller should in front of the larger one
3: we can supress that if both a[i] and a[j] is red so the smaller should also in front fo the larger one

then we can find the solution that
sort first key is color that blue is in front of red;
second is value that the smaller in front of latger one
*/



const int N = 2e5 + 10;

int n;
vector<PII> q;

void solve(){
    q.clear();
    cin >> n;
    for(int i = 0, x; i < n; i ++){
        cin >> x;
        q.push_back({0, x});
    }

    string s;
    cin >> s;
    for(int i = 0; i < n; i ++){

        if(s[i] == 'R'){
            q[i].first = 1;
        }else{
            q[i].first = 0;
        }
    }


    sort(q.begin(), q.end());

    int bg = 0;
    for(int i = 0; i < q.size(); i ++){
        int x = q[i].second;
        if(q[i].first == 0){ //blue
            if(x >= bg + 1){
                bg ++;
            }else{
                cout << "NO" << '\n';
                return;
            }
        }else{  //red
            if(x <= bg + 1){
                bg ++;
            }else{
                cout << "NO" << '\n';
                return;
            }
        }
    }

    cout << "YES" << '\n' ;
}

int main(){
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int T;
    cin >> T;
    while(T--){
        solve();
    }

    return 0;
}